package xframe.util;

import java.io.File;
import java.util.Enumeration;
import java.util.Hashtable;
import org.apache.log4j.Logger;

public class PropertiesValue
{
    private Hashtable propertiesMap;
    private long lastmodifiedDate;
    static Logger log = Logger.getLogger(PropertiesValue.class);

    public PropertiesValue(String path) throws XMLQueryException {
        load(path, (new File(path)).lastModified());
    }

    private void load(String propertiesFile, long lastmodified) throws XMLQueryException {
        lastmodifiedDate = lastmodified;
        propertiesMap = PropertiesReader.put(propertiesFile);
        //System.out.println(xmlSqllMap);
       //ȭ�鿡 ��ȯ�� ������ �ѷ����� �����ϴ� ����
      // UtilMaster.consoleOut("xframe.console.values.Read.show","\"[Variable Properties Changed, now reloadding.....] Reading Properties File:\n"+propertiesFile);
    }

    public String getProperties(String name){
        return (String)propertiesMap.get(name);
    }

	public String toString(){
        return propertiesMap.toString();
    }

    public long getLastmodifiedDate() {
        return lastmodifiedDate;
    }

    public String[] getKeyList(){
        Enumeration eun =  propertiesMap.keys();
        String arr[]=new String[propertiesMap.size()];
        int i =0;
        while (eun.hasMoreElements()) {
            arr[i] = (String)eun.nextElement();
            i++;
        }
        return arr;
    }
}
